package be.tihh.mgmt.tasks;

import be.tihh.mgmt.gui.xml.computers.Computer;

import java.util.ArrayList;

public class TaskListProcessor implements Runnable {

    private ArrayList<Task> tasks;

    public TaskListProcessor(Computer computer) {
        this.tasks = computer.getTasks();
    }

    public void run() {
        for (int i=0; i<tasks.size(); i++){
            Task task = tasks.get(i);
            //don't execute finished tasks
            if(!task.getTaskStatus().getStatus().startsWith(TaskStatus.FINISHED_PREFIX)){
                task.execute();
            }
        }
    }
}
